home *** CD-ROM | disk | FTP | other *** search
/ Sun Solutions 2000 #2 / Sun Solutions CD (Volume 2 2000)(Special Focus - Java Technologies)(Disc 1).ISO / products / Software / SmartenItalia / smarten / roll_img.js < prev    next >
Text File  |  2000-02-13  |  1KB  |  53 lines

  1. function cambia_multi()
  2.     {
  3.     lastarg = cambia_multi.arguments.length;
  4.     // alert(lastarg)
  5.     for(i=0; i<lastarg; i++)
  6.         {
  7.         cambia(cambia_multi.arguments[i])
  8.         }
  9.     
  10.     }
  11.  
  12. function cambia(QUALE)
  13.         {
  14.         eval("quale = document.images."+QUALE)
  15.         srg = quale.src
  16.         e = srg.length - 1
  17.         ext = ""; spe=""; pre = ""
  18.         zona = 1; t=null
  19.         while(e >= 0)
  20.                 {
  21.                 if(zona==1)
  22.                         {
  23.                         if(srg.charAt(e) != "."){ext = srg.charAt(e) + ext}
  24.                         else{zona=2}
  25.                         }
  26.                 if(zona==2)
  27.                         {
  28.                         if(srg.charAt(e-1) == "2"){spe=".";zona=3; t=2}
  29.                         else{spe="_2."; zona=3; t=0}
  30.                         }
  31.                 if(zona==3){pre = srg.substring(0,e-t); break}
  32.                 e--
  33.                 }
  34.         quale.src = pre+spe+ext
  35.         }
  36.  
  37. function cambia_2(QUALE,imago)
  38.         {
  39.         eval("quale = document.images."+QUALE)
  40.         srg = quale.src
  41.         e = srg.length - 1
  42.                 pre="";
  43.         zona = 1;
  44.         while(e >= 0)
  45.                 {
  46.                 if(zona==1 && srg.charAt(e) == "/"){zona=2}
  47.                 if(zona==2){pre = srg.substring(0,e); break}
  48.                 e--
  49.                 }
  50.         quale.src = pre+"/"+imago
  51.                 }
  52.  
  53.